import { request } from '@/utils/request';

// 数据表格
export function getTableList(data) {
  // return request({
  //   url: `/mock/getTableList`,
  //   method: 'get',
  //   data
  // });

  // 临时数据
  const res = {
    code: 0,
    msg: '获取信息成功',
    data: {
      records: [
        {
          key: '8B35E507-7bF6-44Fc-b67a-0f1F348fFcf8',
          code: 4309055486722632,
          num: 71,
          state: 'doing',
          remark: '内都己越给条要别必千属车公线方具青改因国',
          createUser: '文洋',
          updateDate: '2009-04-25'
        }
      ],
      current: '1',
      total: 50000
    }
  };

  new Array(9).fill(1).forEach(() => {
    res.data.records.push({
      ...res.data.records[0]
    });
  });

  return new Promise(resolve => {
    setTimeout(() => {
      resolve(res);
    }, 1000);
  });
}

// 虚拟数据表格
export function getVirtualTableList(data) {
  return request({
    url: `/mock/getVirtualTableList`,
    method: 'get',
    data
  });
}

// 删除表格
export function deleteTable(data) {
  return request({
    url: '/mock/deleteTable',
    method: 'delete',
    params: data
  });
}

// 添加表格
export function addTable(data) {
  return request({
    url: '/mock/addTable',
    method: 'post',
    data
  });
}

// 编辑表格
export function editTable(data) {
  return request({
    url: '/mock/editTable',
    method: 'put',
    data
  });
}

// 获取表格详情
export function getTableDetail(data) {
  return request({
    url: '/mock/getTableDetail',
    method: 'get',
    data
  });
}
